const { app, BrowserWindow } = require('electron');

const path = require('node:path')

// 创建窗口
const createWindow = () => {
  const win = new BrowserWindow({
    width: 800,
    height: 600,
    frame: true, // 创建无边框窗口 false开启
  })

  win.loadFile('./src/index.html')
  win.webContents.openDevTools()
}

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') app.quit()
})

app.whenReady().then(() => {
  createWindow()

  app.on('activate', () => {
    if (BrowserWindow.getAllWindows().length === 0) createWindow()
  })
})